I have opened volume USB device and locked using CreateFile() and DeviceIoControl() in Windows.
I want same functionality on Linux/Unix system. I am new to Unix So How to get it?
My code for Windows :
HANDLE handle = CreateFile(L"\\\\.\\F:", // F: drive to open
GENERIC_READ, // no access to the drive
FILE_SHARE_READ, // share mode
NULL, // default security attributes
OPEN_EXISTING, // disposition
0x1, // file attributes
NULL); // do not copy file attributes
DWORD lpBytesReturned;
if (DeviceIoControl(handle, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &lpBytesReturned, (LPOVERLAPPED)NULL)){
printf("\n Lock SUCCESS !\n");
}
else {
printf("\n Lock Failed !\n");
}
Langage : c/c++
platform: Linux/Unix
Thanks in Advance.